<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 定义函数
        // 求阶乘的和
        var foo = function fun(n) {
            var mul = 1;
            var sum = 0;
            for(i = 1 ; i <= n ; i++) {
                mul *=i; 
                sum += mul;
            }
            console.log(sum);
        };
        // 调用函数
        foo(10);
    </script>
</head>
<body>
    
</body>
</html>